<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;

$this->title = 'create';
?>
<style>
	.add_department .box-footer{text-align:center;border-top:0;}
	.add_department .box-footer button{width:200px;}
</style>
<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<div class="box-header"><h2 class="box-title"><?php if ($model->id){?>部门详情<?php } else {?>新建部门<?php }?></h2></div>
			<div class="box-body add_department">
				<?php $form = ActiveForm::begin(['action' => ['department/create', 'id' => $model->id], 'method' => 'post']);?>
					<div class="box-body">
						<div class="form-group">
							<label for="deparment_uname">部门名称</label>
							<?=Html::textInput('name', $model->name, ['class' => 'form-control', 'placeholder' => '请输入部门名称']);?>
						</div>
						<div class="form-group">
							<label>所属部门</label>
							<?php if ($model->id){?>
								<?=Html::dropDownList('pid', $model->pid, ArrayHelper::map($de_arr, 'id', 'name'), ['class'=>'form-control', 'readonly' => true]);?>
							<?php } else {?>
								<?=Html::dropDownList('pid', $model->pid, ArrayHelper::map($de_arr, 'id', 'name'), ['class'=>'form-control']);?>
							<?php }?>
						</div>
						<?php if ($model->id){?>
						<div class="form-group">
							<label>部门经理</label>
							<?=Html::dropDownList('manager', '', $manager, ['class'=>'form-control', 'readonly' => true]);?>
						</div>
						<div class="form-group">
							<label>部门员工</label>
							<?=Html::dropDownList('employee', '', $employee, ['class'=>'form-control', 'readonly' => true]);?>
						</div>	
						<?php } ?>
					</div>
					<div class="box-footer">
						<button type="submit" class="btn btn-primary">确定</button>
					</div>
				<?php ActiveForm::end();?>
			</div>
		</div>
	</div>
</section>